<%-- 
    Document   : etu
    Created on : 2 déc. 2013, 19:58:34
    Author     : jackson
--%>
<%@page import="com.myapp.struts.modele.Etudiant"%>
<%@page import="com.myapp.struts.modele.Promotion"%>
<%@page import="com.myapp.struts.modele.EstAbsent"%>
<%@page import="com.myapp.struts.modele.Matiere"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">


        <!-- Bootstrap core CSS -->
        <link href="http://getbootstrap.com/dist/css/bootstrap.css" rel="stylesheet">

        <!-- Custom styles for this template -->
        <link href="http://getbootstrap.com/examples/signin/signin.css" rel="stylesheet">

        <!-- Just for debugging purposes. Don't actually copy this line! -->
        <!--[if lt IE 9]><script src="../../docs-assets/js/ie8-responsive-file-warning.js"></script><![endif]-->

        <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
          <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
        <![endif]-->
        <style type="text/css"></style></head>

        <jsp:useBean id="bd" class="com.myapp.struts.modele.QueryBD" scope="session"/>
        <div class="col-md-4"></div>
    <div class="col-md-4">    
        <form  action="DeconnexionAction.do">
                    <button class='btn btn-primary btn-block pull-right' type='submit' value='Deconnexion'>Déconnexion</button>
        </form></div>
    <div class="col-md-4"></div>
    <br>
        <div class="container"><center><h1>Bienvenue dans votre espace personnel 
            <% out.print(bd.getEtudiant().getPrenom());%>
        </h1>
        <h2>Voici vos Absences</h2>
        <br/>
        <center>
        <form method=POST action="DetailsAction.do">
            <table class="table table-hover">
                    <thead>
                      <tr>
                        <th><center>Matiere</center></th>
                        <th><center>Total Absence</center></th>
                        <th></th>
                      </tr>
                    </thead>
                <%

                    for (int i = 0; i < bd.getEtudiant().getMatieres().size(); i++) {
                        out.print("<tbody>");
                        if(bd.getEtudiant().getMatieres().get(i).getAbsence().get(bd.getEtudiant()).getNbTotalAbsence() > 3){
                            out.print("<tr class='danger'>");
                        }else if(bd.getEtudiant().getMatieres().get(i).getAbsence().get(bd.getEtudiant()).getNbTotalAbsence() == 3){
                                out.print("<tr class='warning'>");
                        }else{
                               if(bd.getEtudiant().getMatieres().get(i).getAbsence().get(bd.getEtudiant()).getNbTotalAbsence() < 3){
                                out.print("<tr class='success'>");
                            } 
                        }
                        out.print("<td><center>" + bd.getEtudiant().getMatieres().get(i).getNom() + "</center></td>");
                        out.print("<td><center>" + bd.getEtudiant().getMatieres().get(i).getAbsence().get(bd.getEtudiant()) + "</center></td>");
                        if(bd.getEtudiant().getMatieres().get(i).getAbsence().get(bd.getEtudiant()).getNbTotalAbsence() ==0){
                            out.print("<td></td>");
                        }else{
                            out.print("<td><center><button class='btn btn-large btn-primary' name='details' type='submit' value='"+bd.getEtudiant().getMatieres().get(i).getNom()+ "'><span class='glyphicon glyphicon-calendar'> Details</button></span></center></td>");
                        }
                        out.print("</tr>");
                        out.print("</tbody>");
                    }
                %> 
            </TABLE> 
        </form>
        </div>
    </body>
</html>
